package com.huabo.system.service.impl;

import com.huabo.system.config.DateBaseConfig;
import com.huabo.system.mysql.entity.TblFlowdesMySql;
import com.huabo.system.mysql.mapper.TblFlowdesMySqlMapper;
import com.huabo.system.oracle.entity.TblFlowdes;
import com.huabo.system.oracle.mapper.TblFlowdesMapper;
import com.huabo.system.service.TblFlowdesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TblFlowdesServiceImpl implements TblFlowdesService {

    @Resource
    private TblFlowdesMapper tblFlowdesMapper;
    @Resource
    private TblFlowdesMySqlMapper tblFlowdesMySqlMapper;


    @Override
    public List<TblFlowdes> returnFlowBysqls(String flowid) {
        List<TblFlowdes> flowdes = this.tblFlowdesMapper.findBysqlFlowds(flowid);
        return flowdes;
    }

    @Override
    public List<TblFlowdesMySql> returnFlowByMySqls(String flowid) {
        List<TblFlowdesMySql> flowdes = this.tblFlowdesMySqlMapper.findBysqlFlowds(flowid);
        return flowdes;
    }

    @Override
    public void delete(String id) {

        if (DateBaseConfig.DATABASETYPE.equals("Oracle")) {
            tblFlowdesMapper.deleteByid(id);
        } else {
            tblFlowdesMySqlMapper.deleteByid(id);
        }

    }

    @Override
    public void add(TblFlowdes tblFlowdes) {
        tblFlowdesMapper.insertSelective(tblFlowdes);
    }

    @Override
    public void addMySql(TblFlowdesMySql tblFlowdesMySql) {
        tblFlowdesMySqlMapper.insertSelective(tblFlowdesMySql);
    }
}
